<?php
/**
 * Created by PhpStorm.
 * User: ruma
 * Date: 2019/2/4
 * Time: 14:57
 */

namespace app\index\controller;


use app\common\controller\HomeBaseController;
use mysql_xdevapi\Collection;

class Content extends HomeBaseController
{
    //首页
    public function index()
    {
        //获取文章数据
        $arc_id = input('param.arc_id');
        //文章点击次数+1
//        db('article')->where('arc_id',$arc_id)->setInc('arc_click');
        $articleData = db('article')
            ->where('arc_id','=',$arc_id)
            ->field('arc_id,arc_title,arc_author,arc_content,sendtime')
            ->find();
        halt($articleData);
        $headConf = ['title'=>"ZeBolg--{$articleData['arc_title']}"];
        $this->assign('headConf',$headConf);
        //当前文章标签
        $articleData['tags'] = db('arc_tag')->alias('at')
            ->join('__TAG__ t','at.tid=t.tid')
            ->where('at.arc_id',$articleData['arc_id'])->field('t.tid,t.tname')->select();
        $this->assign('articleData',$articleData);
        return $this->fetch();
    }
}